﻿using System;

namespace TemplateFoundation.UI.WebControls
{
    /// <summary>
    /// Button with EPiServer native appearance for user interfaces inside the EPiServer UI, for example when creating custom properties
    /// </summary>
    public class ToolButton : EPiServer.UI.WebControls.ToolButton
    {
        /// <summary>
        /// Creates a new ToolButton
        /// </summary>
        public ToolButton()
        {
            DisablePageLeaveCheck = true;

            CssClass = "epi-cmsButton";
        }

        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Load"/> event.
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs"/> object that contains the event data.</param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (ButtonType != ToolButtonType.None)
            {
                CssClassInnerButton = "epi-cmsButton-tools epi-cmsButton-" + ButtonType;
            }
        }

        /// <summary>
        /// Gets or sets the type of the button.
        /// </summary>
        /// <value>The type of the button.</value>
        public ToolButtonType ButtonType { get; set; }
    }

    /// <summary>
    /// The type of tool button to render, defines the SkinID used
    /// </summary>
    public enum ToolButtonType
    {
        // TODO Match enum value case against respective CSS class name

        /// <summary>
        /// No button icon
        /// </summary>
        None=0,
        /// <summary>
        /// Plus icon
        /// </summary>
        Add,
        /// <summary>
        /// Plus icon on top of document
        /// </summary>
        AddFile,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        AddFiles,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        AddOff,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        Save,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        SavePublish,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        Report,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        Transform,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        RotateCw,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        Resize,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        FlipH,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        FlipV,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        Crop,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        ImageEditor,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        Undo,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        Revert,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        Redo,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        Window,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        Warning,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        Up,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        UpOff,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        Security,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        Search,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        Refresh,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        RenameFolder,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        QuickEdit,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        Publish,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        Paste,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        Print,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        NewPage,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        NewFile,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        MySettings,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        Help,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        Import,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        File,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        FileManagement,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        Favorite,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        Export,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        EditOff,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        EditMode,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        Edit,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        Down,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        DownOff,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        Delete,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        DeleteFolder,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        DeleteOff,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        Copy,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        Cut,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        Cancel,
        /// <summary>
        /// Appearance option for tool button
        /// </summary>
        Check,
    }
}
